
package com.liangtian.mdm.system.logErrors.controller;

import com.liangtian.mdm.base.controller.BaseController;
import com.liangtian.mdm.util.ExportUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * 移动端登录
 *
 * @author jyh
 */
@Controller
@RequestMapping("/logErrors")
public class LogErrorsController extends BaseController {

    /**
     * 错误日志下载
     *
     * @param
     * @return
     * @author jiangyh
     * @date 2017-06-29
     */
    @RequestMapping(value = "/downLoadErr", method = RequestMethod.POST)
    @ResponseBody
    public void downLoadErr(HttpServletResponse response, HttpServletRequest request) {

        String fileName = request.getParameter("err_fileName");
        try {
            ExportUtil.getErrText(fileName, request, response);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}